<!DOCTYPE html>
{% load i18n static %}
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>产品管理员登录</title>
    <style>
/* 产品管理员专属登录样式 - 绿色主题 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 50%, #43e97b 100%);
    overflow: hidden;
    position: relative;
}

/* 产品元素装饰 */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="50" font-size="40" opacity="0.05">📦</text></svg>'),
        url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="50" font-size="30" opacity="0.05">🏷️</text></svg>');
    background-size: 200px 200px, 150px 150px;
    background-position: 0 0, 100px 100px;
    animation: floatElements 20s ease-in-out infinite;
    z-index: 1;
}

@keyframes floatElements {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(10px, -10px); }
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 2;
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow:
        0 25px 50px rgba(86, 171, 47, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.3);
    padding: 45px;
    width: 100%;
    max-width: 460px;
    backdrop-filter: blur(15px);
    border: 3px solid rgba(86, 171, 47, 0.2);
    animation: bounceIn 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-10deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) rotate(2deg);
    }
    70% {
        transform: scale(0.95) rotate(-1deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 35px;
}

.login-logo {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, #56ab2f 0%, #43e97b 100%);
    border-radius: 20px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 35px;
    color: white;
    box-shadow: 0 8px 25px rgba(86, 171, 47, 0.4);
    position: relative;
    transform: rotate(-3deg);
    transition: all 0.3s ease;
}

.login-logo:hover {
    transform: rotate(0deg) scale(1.05);
}

.login-logo::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, #56ab2f, #43e97b);
    border-radius: 20px;
    z-index: -1;
    opacity: 0.5;
    blur: 5px;
}

.login-title {
    color: #2d5016;
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px 0;
    background: linear-gradient(135deg, #56ab2f, #43e97b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: #5a7c46;
    font-size: 14px;
    margin: 0;
    font-weight: 500;
}

.department-badge {
    display: inline-block;
    background: linear-gradient(135deg, #56ab2f, #43e97b);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.feature-hint {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    border: 2px solid #56ab2f;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 25px;
    text-align: center;
    font-size: 12px;
    color: #2d5016;
    font-weight: 500;
}

.feature-hint::before {
    content: '📦';
    margin-right: 6px;
}

.login-form {
    margin-top: 35px;
}

.form-row {
    margin-bottom: 22px;
    position: relative;
}

.form-row label {
    display: block;
    color: #2d5016;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-row input[type="text"],
.form-row input[type="password"] {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #c8e6c9;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #f1f8e9;
}

.form-row input[type="text"]:focus,
.form-row input[type="password"]:focus {
    outline: none;
    border-color: #56ab2f;
    background: white;
    box-shadow: 0 0 0 3px rgba(86, 171, 47, 0.15);
    transform: translateY(-1px);
}

.submit-row {
    margin-top: 35px;
}

.submit-row input[type="submit"] {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #56ab2f 0%, #43e97b 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.submit-row input[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(86, 171, 47, 0.4);
}

.submit-row input[type="submit"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.submit-row input[type="submit"]:hover::before {
    left: 100%;
}

.error, .errornote {
    background: #ffebee;
    border: 2px solid #ef5350;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
}

.error::before, .errornote::before {
    content: '❌';
    margin-right: 8px;
}

.login-footer {
    text-align: center;
    margin-top: 35px;
    padding-top: 20px;
    border-top: 1px solid #c8e6c9;
}

.login-footer a {
    color: #56ab2f;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.login-footer a:hover {
    color: #43e97b;
    text-decoration: underline;
}

/* 移动端响应式 */
@media (max-width: 480px) {
    .login-container {
        padding: 35px 20px;
        margin: 10px;
    }

    .login-title {
        font-size: 24px;
    }
}
    </style>
</head>
<body>
    <div class="page-wrapper">
        <div class="login-container">
            <div class="login-header">
                <div class="login-logo">
                    📦
                </div>
                <h1 class="login-title">产品管理员</h1>
                <p class="login-subtitle">产品与库存管理中心</p>
                <div class="department-badge">🏷️ PRODUCT ADMIN</div>
            </div>

            <div class="feature-hint">
                管理产品信息、分类、品牌和库存数据
            </div>

            {% if form.errors and not form.non_field_errors %}
                <div class="error">
                    <strong>登录失败：</strong>
                    {% for field in form %}
                        {% if field.errors %}
                            {{ field.errors|striptags }}
                        {% endif %}
                    {% endfor %}
                </div>
            {% endif %}

            {% if form.non_field_errors %}
                <div class="errornote">
                    {{ form.non_field_errors|striptags }}
                </div>
            {% endif %}

            <form method="post" action="{{ app_path }}" class="login-form">
                {% csrf_token %}

                <div class="form-row">
                    <label for="{{ form.username.id_for_label }}">👤 {{ form.username.label }}:</label>
                    {{ form.username }}
                </div>

                <div class="form-row">
                    <label for="{{ form.password.id_for_label }}">🔑 {{ form.password.label }}:</label>
                    {{ form.password }}
                </div>

                <div class="submit-row">
                    <input type="submit" value="📦 进入产品管理后台" />
                    <input type="hidden" name="next" value="{{ next }}" />
                </div>
            </form>

            {% url 'admin_password_reset' as password_reset_url %}
            {% if password_reset_url %}
            <div class="login-footer">
                <a href="{{ password_reset_url }}">🔐 忘记密码？</a>
            </div>
            {% endif %}

            <div class="login-footer">
                <small>© 2024 产品管理系统</small>
            </div>
        </div>
    </div>
</body>
</html>
